<template>
    <div>
        <h3>当前最新的count:{{$store.state.count}}</h3>
        <h4>当前最新的count:{{count}}</h4>
        <button @click="reduce">-1</button>
        <button @click="reduceN(2)">-2</button>
        <button @click="storeReduceN(3)">-3</button>
    </div>
</template>

<script>
    import { mapState,mapMutations } from 'vuex'

    export default {
        name: "reduce",
        methods:{

            reduce:function(){
                this.$store.commit('storeReduce')
            },
            ...mapMutations(['storeReduceN']),
            reduceN:function(n){
                this.storeReduceN(n)
            }

        },
        computed:{
            ...mapState(['count'])

        }
    }
</script>

<style scoped>


</style>